Hi,
On clicking a button on UI, we have to show a dialog or Popup Table on the center of the screen asking user to enter integer value of area(Mandatory) when one condition is met, then user clicks Ok(which has captureAreaVal() function in my script as onclick event) and we have to get that user entered value for assigning to some variable in Handle() method.
With code, I have button called 'Complete' on my UI and its onclick event is Done()
{
Handle(class);
ShowMessage("Class is saved");
}.
In the process we have
Private void Handle(MyClass class)
{
if(class.CrossSection.Elements.Any(element => element.SectionName == "Test1"))
{
lblHeader.Text = "Test Header";
lblArea.Text = "Test label";
ClientScript.RegisterStartupScript(this.GetType(), "ShowPopup", "showAreaPopup();", true); //at this point the popup table is not seen
return; //debugger hits till here and skips or goes to last line of Handle method
}
```int TestOneArea= hiddenarea.Value;
class.Details.Add(new Detail() {Name = "Test1Name", Value = TestOneArea});
if(class.CrossSection.Elements.Any(element => element.SectionName == "Test2" ))
{
//similar code as above block to show popup if sectionName is Test2
}
When I'm debugging the code, the debugger after hitting last line handle() method, Loads my page with with message in ShowMessage() and after that shows the popup.
function showAreaPopup() {
var x = document.getElementById("idPopup");
x.style.visibility = "visible";
}
var areaVal = document.getElementById('<%=TxtboxArea.ClientID%>').value;
if (areaVal && !isNaN(areaVal) && parseInt(areaVal) > 0) {
document.getElementById('<%=hiddenArea.ClientID %>').value = areaVal;
console.log("in captureareaval()", areaVal);
return true;
}
if(areaVal == null || areaVal == '') {
alert('Affected area is mandatory');
return false;
}
if (isNaN(areaVal)) {
alert('Please enter integer value for area affected');
return false;
}
}
Thank you